home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Info-Mac 3
/
Info_Mac_1994-01.iso
/
Configuration
/
sAVe the Disk 1.2.1
/
Read Me
next >
Wrap
Text File
|
1993-12-07
|
11KB
|
234 lines
sAVe the Disk 1.2.1
-------------------
Overview
sAVe the Disk 1.2.1 is a FreeWare system extension (aka INIT) which will
alleviate the excessive disk drive hits experienced by owners of AV Macs
in the following two circumstances:
1) The traps ChangedResource and AddResource flush the whole file to disk each
time they are invoked. This significantly degrades performance if many
resources are changed in succession, e.g. while linking programs or running
resource compilers.
2) Each time a sound channel is allocated (disposed) some information is read
from (written to) the file DSP Preferences. Applications which follow Apple's
recommendations create and destroy such a channel for each single sound they
produce and thus slow down while they torture your harddisk. This problem
becomes most obvious with games.
Note that the extension AV Speedup 1.0 (developed by Matt Gough and Brian Stroud)
addresses only the first set of problems, while sAVe the Disk deals with the
sound related stuff, too.
Installation
Simply drop the sAVe the Disk extension onto the icon of the closed system
folder and let the Finder place it in the Extensions folder. Then restart your
machine. sAVe the Disk 1.2.1 will load and display its icon while it installs
itself during start-up.
Does it work?
The following is a simple way to test if sAVe the Disk is operating properly. In
the Finder select Page Setup from the File menu and click _outside_ the dialog
box several times. The system beep should sound for each click. However disk
activity should only occur prior to the first beep when the actual sound data is
read from its resource inside the system file. There should be no disk hits for
the repeated sounds. Compare this with the ongoing disk accesses before you
installed sAVe the Disk. Now you could enjoy one of your former favorite games
without disk noise and without jerky delays degrading animation. The increased
speed of some Resource Manager operations should be noticeable when building
large programs.
If it doesn't work
As sAVe the Disk uses only 2.2k of system memory plus the size of your DSP
Preferences file (usually less than 0.5k) there should always be sufficient
memory available.
The extension will only install itself, if ROM version 1917 (0x77D) is present.
This is intended to prevent problems if somebody tries to use sAVe the Disk on
a non-AV Mac. No icon will be displayed during start-up and no changes to the
system will be made, if the ROM version does not match.
I developed and tested sAVe the Disk on my Centris/Quadra 660av running System
7.1 and version 1.1 of the System Enabler 088, but it is known to work on a
Quadra 840av, too. Some additional testing has been done whith the 1.0 Enabler.
Although it has not caused me any trouble I'm not responsible for any (unlikely)
problems you may experience.
Please note that sAVe the Disk does _not_ fix the problems with games which
write to the (on the AV Macs nonexistent) Apple Sound Chip directly and
therefore produce no sound at all. You should contact the publisher of such
software and ask for a fix or update.
Feel free to contact me at the address given below if you encounter any problems
related to sAVe the Disk 1.2.1.
Known Problems
None (again). Oh, but you can't look at the modification time of DSP Preferences
to find out when your Mac has last beeped anymore ;^)
How does it work?
(optional reading)
1) Resource Manager
ChangedResource, AddResource are head-patched to set a flag. The modified
version of FlushFile (another head-patch) will check this flag, clear it and
suppress the actual flushing of the file if the flag was set. This works
because both resource calls contain exactly one internal call to the
FlushFile trap. A final head-patch to ResError does also clear the flag, so
that the next call to FlushFile will operate normaly, even if
ChangedResource/AddResource returned an error before calling FlushFile on
their own. Programs should be calling ResError afterwards, as this is the
only way to check the success of ChangedResource/AddResource.
2) DSP Preferences
Two subfunctions of the DSPDispatch trap (ABF5) access the file DSP
Preferences inside the Preferences folder and cause the sound related disk
hits (selector 0x121 to read info, 0x5F to update the info). Both
subfunctions are replaced by entirely new routines modelled after the
originals. When the DSP Preferences file is first accessed, its contents are
stored in a relocatable block inside the system heap. Further accesses just
read the info from memory, update it in memory or grow the block and append
new information. A shutdown handler will finally update the file on disk
before you restart or shutdown you Macintosh. This should cause no problems
as the DSP Preferences file is small (usually less than 500 bytes) and the
updated information records past DSP performance data as an estimate for
future uses. Thus it is no real problem if a system crash should keep the
data from getting written back. The estimates used will just be slightly less
accurate as they result from older measurements.
Another subfunction of the DSPDispatch trap is used to repeatedly read a
resource of type 'dspf' from the System Enabler 088 and will DetachResource
in order to return a non-resource handle to its caller. Thus the resource
data is read from disk each time, still resulting in sound related disk
trashing under the 1.0 Enabler. With the 1.1 Enabler the system's disk cache
was usually able to prevent actual disk access. A head-patch to the
DSPGetResource subfunction (0x124) will handle requests for resources of type
'dspf' and use HandToHand in order to copy the requested data into a new
non-resource handle. The original resource handle is marked purgable so that
its 4.5k can be reclaimed if the system runs out of memory (the resource will
be reread from disk the next time it is accessed). For resource types other
than 'dspf' and in case of any error the patch invokes the original ROM code.
The ROM code seems to support an additional special resource file, which is
examined if a request can't be satisfied by the currently open files.
Although this feature appears to be currently unused, the fallback to the
original routine should guarantee 100% compatibility.
If you want to trash your DSP Preferences file because it has grown too large,
proceed as follows: restart your Mac and put the file into the trash before any
sound is produced (except the usual noise at start-up). Hold down the SHIFT-key
during start-up to prevent other extensions from accessing the Sound Manager
before the Finder has been started, if required. After the first sound has been
played the file is kept in memory and will be completely rewritten at shutdown
(or prior to a restart) even if you trashed it.
The Original Note on 840AV Disk-Trashing
(as distributed with AV Speedup 1.0)
There are at least two serious disk-related bugs in the 840AV, which have been
verified by DTS:
1) ChangedResource now flushes the resource's entire file out to disk. This is
first noticeable during a System install, when the Installer will take several
minutes to construct the System file. But it is most heinous during MPW Rez
and Link. My project takes 5 to 10 times longer to build (than on an 800)
because the entire file is written to disk hundreds or thousands of times in
rapid succession as each resource is added to my app. Of course, this bug will
make any program run slower if it adds, changes or deletes resources.
2) SndDisposeChannel will hit the disk for some retarded reason. Apple says
the DSP chip is behind this. Every time a system beep is played, for example,
you'll notice a couple of "ca-chunks" from your hard disk. This is especially
harsh on sound-intensive applications (like games). Many games slow down to a
jerky crawl because they typically call SndDisposeChannel after each sampled
sound completes. The workaround is to leave a sound channel open and reuse
it for each sampled sound until you quit or suspend your app.
Apple DTS classifies these bugs as "goofinesses", and currently offers no plans
to fix them.
Todd Ouzts
Author: DAYNA
Many Thanks To
Dave Schutz for the icon (taken from his Colossal Icons collection). Otherwise
sAVe the Disk would have to go with the default icon for system extensions and
would have no super hero to stand behind its noble aim.
Matt Gough and Brian Stroud who brought the Resource Manager deficiencies to my
attention and made me put my vague ideas about a solution to the sound problem
into actual code. From their AV Speedup distribution I got to know that there
was no point in waiting for a fix from DTS (see note above).
Malcolm Slaney from the ATG Perception Group who made the source to the DSP
related application VUMeter publicly available. The included headers shed some
light onto the DSP trap interface and turned mysterious entities into
comprehensible data structures.
Patrick C. Beard who placed his ShowIconFamily code in the public domain. He
made the successful installation of sAVe the Disk visible.
Legal Stuff
sAVe the Disk 1.2.1 is provided free of charge but remains copyright Michael
Thies. It may not be sold for profit but may otherwise be distributed freely in
unmodified form and complete with this unaltered documentation. It may be
included with ShareWare or commercial products, if I have been informed of the
intended bundling in advance and it is made clear that sAVe the Disk itself
comes free of charge and does not form part of the actual product sold.
sAVe the Disk 1.2.1 is provided in the hope that it will be useful but comes
with _absolutely_ NO warranty.
It was developed with THINK C 6.0.1 so parts of it may be Copyright Symantec
Corporation.
Several terms used above are trademarks of their respective holders.
Version History
1.0 11/23/93 Initial Version
1.1 11/25/93 - fixed bug which could prevent access to prefs file
- UpdateGPBPrefFile subfunction will read prefs file into
memory, if GetGPBModes was never called before
- Resource Manager patches are more robust. Even in case of
errors no call to FlushFile should get accidently ignored.
- Icon gets displayed during start-up if installation
successful
- fine-tuned code
1.1.1 12/04/93 - added compatibility with version 1.0 of the System Enabler
(additional work will be needed to prevent ALL disk
trashing with the 1.0 Enabler)
- more work done at installation time => less resident code
1.2 12/05/93 - work around for 1.0 Enabler added: no more disk trashing
- no reliance on systems's disk cache with any Enabler
- resident code nearly back to old (v1.1) size :-(
1.2.1 12/07/93 - create copy of 'dspf' resource in heap zone where resource
was loaded (application vs. system heap)
I am always interested in comments, suggestions and bug reports (sigh).
---------------------------------------------------
Michael Thies (andymon@uni-paderborn.de)
Fachbereich Informatik
Universitaet-Gesamthochschule Paderborn
Germany